<template>
    <div class="about-container">
        <p>这里是about组件</p>
        <p>接收到的数据：{{ amount }}</p>
    </div>
</template>

<script>
//import  * from '' 
import { ref, getCurrentInstance, ComponentInternalInstance, onBeforeMount, onMounted } from 'vue';
 
const amount = ref(0);
const { appContext } = getCurrentInstance() as ComponentInternalInstance;
 
onMounted(() => {
    appContext.config.globalProperties.$mitt.on('moneyEvent', (res: number) => {
        amount.value = res;
    })
})
 
onBeforeMount(() => {
    appContext.config.globalProperties.$mitt.off('moneyEvent');
});
</script>
 
<style scoped>
  
</style>